import React from 'react';

interface PrintViewProps {
  printHtml: any;
}

class PrintViewElem extends React.Component<PrintViewProps> {
  componentDidUpdate(prevProps: any) {
    // const { printHtml } = this.props;
    const { document }: any = window;
    // const { innerHTML = '' } = document.getElementById('billDetails');
    // if (printHtml && innerHTML) {
    //   const iframe = window.frames[0];
    //   iframe.document.head.innerHTML = document.head.innerHTML; // 获取当前文档的头部给iframe
    //   iframe.document.body.innerHTML = innerHTML; // 把传过来的html给iframe <body>

    //     //   打印
    //   iframe.window.print();
    // }
  }

  render() {
    return (
      <iframe id="iframe" style={{ display: 'none' }} title="iframe" />
    );
  }
}

export default PrintViewElem;
